# $Id: PKGBUILD 81175 2012-12-12 18:42:48Z bpiotrowski $
# Maintainer:  Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Geoffroy Carrier <geoffroy.carrier@koon.fr>
# Contributor: michalzxc
# Contributor: nbags <neilbags@gmail.com>

pkgname=fail2ban
pkgver=0.8.8
pkgrel=1
pkgdesc='Bans IPs after too many failed authentification attempts against common daemons'
url='http://www.fail2ban.org/'
license=('GPL')
arch=('any')
depends=('python2' 'iptables')
backup=(etc/fail2ban/fail2ban.conf
        etc/fail2ban/jail.conf)
source=($pkgname-$pkgver.tar.gz::https://nodeload.github.com/$pkgname/$pkgname/legacy.tar.gz/$pkgver
		rc.d service tmpfiles.conf)
md5sums=('352f41692cc731297b078923e46d3aea'
         '70caa58e130a13a505d63a35b9aecfb6'
         'b4af226eb2d3029241a70e005ec7b3ac'
         '78b42dea76c6c824b813dad9edc37377')

package() {
  cd $srcdir/$pkgname-$pkgname-*/
  python2 setup.py install --root $pkgdir

  install -Dm755 $srcdir/rc.d $pkgdir/etc/rc.d/$pkgname
  install -Dm644 $srcdir/service $pkgdir/usr/lib/systemd/system/$pkgname.service
  install -Dm644 $srcdir/tmpfiles.conf $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf

  # avoid conflict with filesystem>=2012.06
  rm -r $pkgdir/var/run
}
